import { Route, Navigate, Routes } from 'react-router-dom';
import React, { Suspense, lazy } from 'react';

// 引入组件
const Login = lazy(() => import('../pages/login'));
const Main = lazy(() => import('../pages/main'));

const routerData = () => (
  <Suspense fallback={<div>loading...</div>}>
    <Routes>
      {/* 重定向 */}
      <Route path="/" element={<Navigate replace to="/login" />} />
      <Route path="/login" element={<Login />} />
      <Route path="/main" element={<Main />} />
    </Routes>
  </Suspense>
);

export default routerData;
